package com.book.dacnhantam.dialog;

import android.app.Dialog;
import android.content.Context;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.book.dacnhantam.data.Bookmark;
import com.book.dacnhantam.data.DatabaseHelper;

public class BookmarkSaveDialog extends Dialog
  implements View.OnClickListener
{
  private Button cancelButton;
  private int chapterID;
  private DatabaseHelper dbHelper;
  private EditText nameEditText;
  private Button saveButton;
  private int scroll;

  public BookmarkSaveDialog(Context paramContext)
  {
    super(paramContext);
    requestWindowFeature(1);
    setContentView(2130903041);
    this.saveButton = ((Button)findViewById(2131230723));
    this.cancelButton = ((Button)findViewById(2131230724));
    this.nameEditText = ((EditText)findViewById(2131230722));
    this.saveButton.setOnClickListener(this);
    this.cancelButton.setOnClickListener(this);
    this.dbHelper = new DatabaseHelper(paramContext);
  }

  public void onClick(View paramView)
  {
    if (paramView == this.saveButton)
    {
      Bookmark localBookmark = new Bookmark();
      String str = this.nameEditText.getText().toString();
      if (str == null)
        str = "Không tên";
      localBookmark.setChapterID(this.chapterID);
      localBookmark.setName(str);
      localBookmark.setScroll(this.scroll);
      localBookmark.setTime(System.currentTimeMillis());
      if (this.dbHelper.insertBookmark(localBookmark) != -1L)
        break label109;
      Toast.makeText(getContext(), "Không thể lưu được vị trí đánh dấu", 0).show();
    }
    while (true)
    {
      dismiss();
      if (paramView == this.cancelButton)
        dismiss();
      return;
      label109: Toast.makeText(getContext(), "�?ã đánh dấu trang đang đ�?c", 0).show();
    }
  }

  public void show(int paramInt1, int paramInt2)
  {
    this.chapterID = paramInt1;
    this.scroll = paramInt2;
    this.nameEditText.setText("Hồi " + paramInt1 + " (" + paramInt2 + ")");
    this.nameEditText.selectAll();
    show();
  }
}

/* Location:           C:\Users\chutieucodon\Desktop\dec\com.book.dacnhantam-36fb9c182ef79376b618c867d3d1c347\classes_dex2jar.jar
 * Qualified Name:     com.book.dacnhantam.dialog.BookmarkSaveDialog
 * JD-Core Version:    0.6.0
 */